package com.loong.seller.controller.forehead;

import com.loong.common.mvc.BaseForeheadController;
import com.loong.common.rest.Result;
import com.loong.seller.common.forehead.param.ShopTypeForeheadParam;
import com.loong.seller.common.forehead.param.ShopTypeQueryForeheadParam;
import com.loong.seller.handler.ShopTypeHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description: 店铺类型控制 c端
 * @Author: hzp
 * @Date: 2020-12-3 9:24
 */
@RestController
@RequestMapping("/forehead/seller/shopType")
public class ShopTypeForeheadController extends BaseForeheadController {

    @Resource
    private ShopTypeHandler shopTypeHandler;

    /**
     * 分页查询 c端
     * @param param 查询条件
     * @return 店铺分页结果集
     */
    @PostMapping("pageQuery")
    public Result pageQuery(  @RequestBody ShopTypeQueryForeheadParam param){

        return  handlerExecutor.execute(()->shopTypeHandler.pageQuery(param));
    }

    /**
     * 查询所有店铺类型 c端使用
     * @return
     */
    @PostMapping("findAll")
    public Result findAll(){
        return  handlerExecutor.execute(()->shopTypeHandler.findAll());
    }

    /**
     * 根据type 查询 店铺分类 1 代表外卖 2 代表商城
     * @param param
     * @return
     */
    @PostMapping("findShopTypeByType")
    public Result findShopTypeByType(@RequestBody ShopTypeForeheadParam param){
        return handlerExecutor.execute(()->shopTypeHandler.findShopTypeByType(param.getType()));
    }
}
